#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 文件名：04-if.py

a = 0
b = 200

# ===简单的if-else===

#比较 判断值是否相同
if  a== b:
    print " a = b "
else:
    print " a != b "


# 逻辑
if not (a or b):
    print "true"
else:
    print "false"


# 身份运算符，判断引用是否相同

if a is b:
    print "a和b有相同的id"
else:
    print "a和b不同的id"


# ===没有switch命令，多用多重的if-elseif-else===

num3 = 15

if num3 == 3:
    print "other"
elif num3 == 4:
    print "work"
else:
    print "boss"
    
# ===多条件===
print "多条件判断"
if (num3 > 0 and num3 < 6) or (num3 > 10 and num3 < 16):
    print "15在0-6范围或者在10-16中"


# 空值为None,False,0,0.0,0L,'',(),[],{}
# 判断字符串为空 ,推荐这种方式
str1 = ""
if str1.strip() == '':
    print len(str1)
    print "str1是空字符串"


'''不推荐len
str2 = "  "
if len(str2) == 0:
    print "str2是空字符串"
else:
    print len(str2)
    print "str2非空"
'''

# 判断是否是字符型
str3 = 2
if not isinstance(str3, int):
    print "yes"
else:
    print "no"
